package funcs

import (
	"io/ioutil"
	"path/filepath"
)
//递归获取目录下的所有文件
func GetAllFile(pathname string,s []string) ([]string, error) {
	rd, err := ioutil.ReadDir(pathname)
	if err != nil {
		return s, err
	}
	for _, fi := range rd {
		if fi.IsDir() {
			fullDir := filepath.Join(pathname, fi.Name())
			s, err = GetAllFile(fullDir, s)
			if err != nil {
				return s, err
			}
			continue
		} else {
			fullName := filepath.Join(pathname,fi.Name())
			s = append(s, fullName)
		}
	}
	return s, nil
}
